From: Jonas Dreßler Date: Mon, 8 Jun 2020 15:52:57 +0000 (+0200) Subject: workspace: Adjust for close button side in chromeWidth X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~268 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=96bfd1f8bedb02105f7b3c292667ae29e571b50d;p=gnome-shell.git workspace: Adjust for close button side in chromeWidth When the close button is shown on the left side of the WindowClone, we also need to return its width in chromeWidth() on the left side instead of the right side, so do that. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1298 --- diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 97b5f8cc9..a64ed0b99 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -308,8 +308,9 @@ var WindowClone = GObject.registerClass({ }); const layout = Meta.prefs_get_button_layout(); - const side = layout.left_buttons.includes(Meta.ButtonFunction.CLOSE) - ? St.Side.LEFT : St.Side.RIGHT; + this._closeButtonSide = + layout.left_buttons.includes(Meta.ButtonFunction.CLOSE) + ? St.Side.LEFT : St.Side.RIGHT; this._closeButton = new St.Button({ visible: false, @@ -324,7 +325,7 @@ var WindowClone = GObject.registerClass({ source: this._border, align_axis: Clutter.AlignAxis.X_AXIS, pivot_point: new Graphene.Point({ x: 0.5, y: -1 }), - factor: side === St.Side.LEFT ? 0 : 1, + factor: this._closeButtonSide === St.Side.LEFT ? 0 : 1, })); this._closeButton.add_constraint(new Clutter.AlignConstraint({ source: this._border, @@ -395,16 +396,26 @@ var WindowClone = GObject.registerClass({ const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1); const [, titleHeight] = this._title.get_preferred_height(-1); - return [this._borderSize + closeButtonHeight / 2, - Math.max(this._borderSize, (titleHeight / 2) + (this._borderSize / 2))]; + const topOversize = this._borderSize + closeButtonHeight / 2; + const bottomOversize = Math.max( + this._borderSize, + (titleHeight / 2) + (this._borderSize / 2)); + + return [topOversize, bottomOversize]; } chromeWidths() { this._border.ensure_style(); const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1); - return [this._borderSize, - this._borderSize + closeButtonWidth / 2]; + const leftOversize = this._closeButtonSide === St.Side.LEFT + ? this._borderSize + closeButtonWidth / 2 + : this._borderSize; + const rightOversize = this._closeButtonSide === St.Side.LEFT + ? this._borderSize + : this._borderSize + closeButtonWidth / 2; + + return [leftOversize, rightOversize]; } showOverlay(animate) {